<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        .container {
            background-color: antiquewhite;
            margin: auto;
            font-size: 24px;
            background-color: antiquewhite;
            text-align: center;
        }

        footer {
            font-size: small;
            font-family: 'Times New Roman', Times, serif;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>百度视频下载助手</h1>
        <p id="message">正在下载,请稍等！</p>
        <hr>
        <footer>
            <p>版权所有@曾辉</p>
        </footer>
    </div>
    <script>
        fetch('<%=url%>', { referrerPolicy: 'no-referrer', mode: 'cors' }).then(res => res.blob()).then(blob => {
            const blobUrl = window.URL.createObjectURL(blob)
            const a = document.createElement('a')
            document.body.appendChild(a)
            a.style.display = 'none'
            a.href = blobUrl
            a.download = '<%=title%>.mp4'
            a.click()
            document.body.removeChild(a)
            window.URL.revokeObjectURL(blobUrl)
        }).then(function () {
            const message = document.getElementById('message')
            message.innerHTML = '下载完成'
        })
    </script>
</body>

</html>